#pragma once
#include "PDTNode.h"
#include <map>

class PDTConst {
public:
	PDTConst();
	virtual PDTNode * getNode() const =0;
	operator PDTNode*(){return getNode();}
	virtual NodeTypeEnum getType(){return PDTConst_Em;}

    virtual long long getNumber () const {
        pdt_throw PDTConstTypeEx; return 0; }
    virtual bool getBoolean () const {
        pdt_throw PDTConstTypeEx; return false; }
    virtual double getDouble () const {;
        pdt_throw PDTConstTypeEx; return 0.0;}

    virtual bool getConcrete(bool ) const {
            return getBoolean();
    }
    virtual int getConcrete(int ) const {
            return (int) getNumber();
    }
    virtual long long getConcrete(long long ) const {
            return getNumber();
    }
    virtual double getConcrete(double ) const {
            return getDouble();
    }

    virtual bool isEqual (const PDTConst & rhs) const=0;


    static map<long long,PDTConst *> intConsts;
    static map<double,PDTConst *> doubleConsts;
    static PDTBoolConst * PDTTrue;
    static PDTBoolConst * PDTFalse;

    static PDTConst * makeConst(PDTCodeGraph &cg,int i);
    static PDTConst * makeConst(PDTCodeGraph &cg,long long l);
    static PDTConst * makeConst(PDTCodeGraph &cg,bool b);
    static PDTConst * makeConst(PDTCodeGraph &cg,double v);

    #if 0
    //TODO:
    virtual vector<PDTConst *> * getVector() const {
         pdt_throw PDTConstTypeEx; return NULL;}
    #endif
};

